#include <stdio.h>
#include <stdlib.h>

int main(int argc, char **argv)
{
    FILE *fp = NULL;
    char buf[20] = {0};

    if(NULL == (fp = fopen(argv[1], "r"))){
        perror("open file error!\n");
        exit(-1);
    }

    printf("open file success!\n");

    if(0 > fseek(fp, 0, SEEK_END)){
        perror("seek file error!\n");
        fclose(fp);
        exit(-1);
    }

    if(10 > fread(buf, 1, 10, fp)){
        if(feof(fp))
            printf("end-of-file sign is set!\n");

        clearerr(fp);
    }

    fclose(fp);
    exit(0);
}
